﻿namespace NetFx.SMIL.Definitions
{
  using System;
  using System.Text;
  using System.Collections;

  using System.Reflection;
  using System.Reflection.Emit;
  using System.Runtime.InteropServices;

  using System.Diagnostics;
  using System.Diagnostics.CodeAnalysis;
  using System.Diagnostics.SymbolStore;
  using System.Security;
  using System.Security.Permissions;

  using NetFx.MSIL;
  using NetFx.MSIL.Headers;

  public class ModuleDefinition : ComplexDefinition
  {
    #region Statics
    public static ModuleDefinition of(string name)
    {
      return new ModuleDefinition(name);
    }
    #endregion
    #region Fields
    #endregion
    #region Properties
    public virtual ModuleHeader InstanceHeader
    {
      get
      {
        return this.header as ModuleHeader;
      }
    }
    public virtual string FileName
    {
      get
      {
        return this.InstanceHeader.FileName;
      }
      set
      {
        this.InstanceHeader.FileName = value;
      }
    }
    public virtual bool EmitSymbol
    {
      get
      {
        return this.InstanceHeader.EmitSymbol;
      }
      set
      {
        this.InstanceHeader.EmitSymbol = value;
      }
    }
    #endregion
    #region Constructors
    public ModuleDefinition(string name)
      : this(ModuleHeader.of(name))
    {

    }
    public ModuleDefinition(ModuleHeader header)
      : base(header)
    {

    }
    #endregion
    #region Methods
    public virtual TypeDefinition DefineType(string name)
    {
      return this.AddDefinition(
        ComplexDefinition.CreateTypeDefinition(name)
        ) as TypeDefinition;
    }
    public virtual EnumDefinition DefineEnum(string name)
    {
      return this.AddDefinition(
        ComplexDefinition.CreateEnumDefinition(name)
        ) as EnumDefinition;
    }
    public virtual MethodDefinition DefineMethod(string name)
    {
      return this.AddDefinition(ComplexDefinition.CreateMethodDefinition(name)) 
        as MethodDefinition;
    }

    protected override void Resolve(ComplexDefinition container)
    {

    }
    #endregion
  }
}